﻿using System;

namespace studa_delegate{
    /// <summary>
    ///  委托 
    /// </summary>
    class Program
    {
        public delegate void actoin() ;
        static void Main(string[] args)
        {
            //Console.WriteLine("Hello World!");
            
            actoin a = new actoin(peb.BuyFood);
            a += peb.BuyCake;
            a += peb.BuyFlower;
            a -= peb.BuyFood;
            a();
            Console.ReadKey();
        }


        class peb{

            public static void BuyFood()
            {
                Console.WriteLine("购买快餐！");
            }
            public static void BuyCake()
            {
                Console.WriteLine("购买蛋糕！");
            }
            public static void BuyFlower()
            {
                Console.WriteLine("购买鲜花！");
            }
        }
    }
}
